package com.example.helloworld;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.os.Bundle;
import android.widget.SeekBar;
import android.widget.TextView;

import com.example.util.ToastUtil;

public class SeekBarActivity extends AppCompatActivity {
    private SeekBar sb_normal,sb_custom;
    private TextView textView;
    private Context mContext;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_seek_bar);
        mContext = this;
        sb_normal = findViewById(R.id.sb_normal);
        textView = findViewById(R.id.tv);
        sb_custom = findViewById(R.id.sb_custom);
        sb_normal.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                textView.setText("当前进度值："+progress+"/100");
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                ToastUtil.showMsg(mContext,"start touch");
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                ToastUtil.showMsg(mContext,"stop touch");
            }
        });

//        sb_custom.setSecondaryProgress(20);

    }
}